﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Styx;
using Styx.Combat.CombatRoutine;
using Styx.Helpers;
using Styx.Logic;
using Styx.Logic.BehaviorTree;
using Styx.Logic.Combat;
using Styx.Logic.Pathing;
using Styx.Logic.POI;
using Styx.WoWInternals.WoWObjects;
namespace Healz.Druid.Spells
{
    public static class Regrowth
    {
        public const string SpellName = "Regrowth";

        public static bool Pulse(WoWPlayer Player)
        {
            // Our checks
            if (Player.HealthPercent > Main.cSettings.Regrowth_Percent) return false;
            if (Player.Distance2D > SpellManager.Spells[SpellName].MaxRange) return false;
            if (!SpellManager.Spells[SpellName].CanCast) return false;
            if (MySpellManager.HasMyAura(Player, SpellName)) return false;

            // If we dont have tree of life, we check if we are moving
            if (!MySpellManager.HasMyAura(StyxWoW.Me, "Tree of Life"))
            {
                if (StyxWoW.Me.IsMoving) return false;
            }

            // Cast and write
            Utils.WriteCast(SpellName, Player);
            SpellManager.Cast(SpellName, Player);

            return true;
        }

        /// <summary>
        /// Has a 1 in 3 chance of doing
        /// Regrowth
        /// </summary>
        /// <param name="Player"></param>
        /// <returns></returns>
        public static bool RandomPulse(WoWPlayer Player)
        {
                Random num = new Random();
                int numb = num.Next(0,2);
                if (numb == 0)
                {
                    return Pulse(Player);
                }

                return false;
        }
    }
}
